<template>
	<view class="goods_list">
		<view class="goods_item" v-for="item in hotgoods" :key="item.id" @click="navigator(item.id)">
			<image src="../../static/index/goods/jita.webp"></image>
			<view class="price">
				<text>{{item.sell_price}}</text>
				<text>{{item.market_price}}</text>
			</view>
			<view class="name">
				{{item.zhaiyao}}
			</view>
		</view>
	</view>
</template>

<script>
	export default{
		/* 接收外面传过来的数据 */
		props:['hotgoods'],
		
		methods:{
			/* 根据id传过去 */
			navigator(id){
				this.$emit('goodsItemClick',id)
			}
		}
	}
</script>

<style lang="scss">
	.goods_list{
		padding: 0 15rpx;
		display: flex;//在一行显示
		flex-wrap: wrap;//换行
		justify-content: space-between;//左右间距
		.goods_item{
			background-color: #fff;
			width: 355rpx;
			margin: 10rpx 0px;
			padding: 15rpx;
			box-sizing: border-box;
			image{
				width: 300rpx;
				height: 300rpx;
				display: block;
				margin: 0 auto;//图片居中
			}
			.price{
				color: red;
				font-size: 30rpx;
				margin: 7rpx 0;
				text:nth-child(2){
					color: #ccc;
					font-size: 28rpx;
					margin-left: 7rpx;
					text-decoration: line-through;
				}
			}
			.name{
				font-size: 28rpx;
				line-height: 50rpx;
				padding:10rpx 0px 7rpx 0rpx ;
			}
		}
	}
</style>
